<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>项目款项列表-目的地运营集团数据管理平台</title>
<include file="Include:style" />
<style>
	.background{ background: #f5f5f5; }
</style>
</head>
<body>
<include file="Include:header" />
<include file="Include:left" />
<div id="main">
	<div class="crumbs">
		<div class="crumbs-text">项目款项列表</div>
		<div class="right">
				<if condition="$mode eq 1">
					<if condition="get_permission('KX',NULL,1) or get_permission('KX',NULL,2)">
					<a href="__APP__/Financial/invoice_add/mode/{$mode}" class="btn left mr5">添加项目开票</a>
					</if>
					<if condition="get_permission('KX',NULL,1) or get_permission('KX',NULL,3)">
					<a href="__APP__/Financial/receivables_add/mode/{$mode}" class="btn left mr5">添加项目收款</a>
					</if>
				<elseif condition="$mode eq 2"/>
					<if condition="get_permission('KX',NULL,1)">
					<a href="__APP__/Financial/project_funds_add/mode/{$mode}" class="btn left mr5">添加项目款项</a>
					</if>
				</if>
			
			<div class="input-group left w200">
		    	<input type="text" id="keyword" value="{$keyword}" class="form-control" placeholder="按项目编号/名称搜索" autocomplete="off">
	    		<span class="input-group-btn">
	        		<button class="btn found_btn" type="button">搜索</button>
		    	</span>
		    </div>
		</div>
	</div>
	<div id="content">
		<div class="filter">
			<div class="filter-item">
				<div class="filter-title">筛选方式：</div>
				<ul class="filter-order">
					<li <if condition="$mode eq 1">class="current"</if>>
						<a href="__APP__/Financial/project_funds/keyword/{$keyword}/mode/1/center_id/{$center_id}/type/{$type}/ptype/{$ptype}">按单据</a>
					</li>
					<li <if condition="$mode eq 2">class="current"</if>>
						<a href="__APP__/Financial/project_funds/keyword/{$keyword}/mode/2/center_id/{$center_id}/type/{$type}/ptype/{$ptype}">按项目</a>
					</li>
				</ul>
			</div>
			<div class="filter-item">
				<div class="filter-title">所属中心：</div>
				<ul class="filter-order">
					<foreach name="pro_list" item="vo">
						<li <if condition="$center_id eq $vo['name2']">class="current"</if>>
							<a href="__APP__/Financial/project_funds/keyword/{$keyword}/mode/{$mode}/center_id/{$vo['name2']}/type/{$type}/ptype/{$ptype}">{$vo['name1']}</a>
						</li>
					</foreach>
				</ul>
			</div>
			<div class="filter-item">
				<div class="filter-title">项目类型：</div>
				<ul class="filter-order">
					<li <if condition="$ptype eq -10">class="current"</if>>
						<a href="__APP__/Financial/project_funds/keyword/{$keyword}/mode/{$mode}/center_id/{$center_id}/type/{$type}/ptype/-10">全部</a>
					</li>
					<foreach name="ptype_list" item="vo">
						<li <if condition="$ptype eq $vo['id']">class="current"</if>>
							<a href="__APP__/Financial/project_funds/keyword/{$keyword}/mode/{$mode}/center_id/{$center_id}/type/{$type}/ptype/{$vo['id']}">{$vo['second_name']}</a>
						</li>
					</foreach>
				</ul>
			</div>
			<div class="filter-item">
				<div class="filter-title">开票/收款：</div>
				<ul class="filter-order">
					<li <if condition="$type eq -10">class="current"</if>>
						<a href="__APP__/Financial/project_funds/keyword/{$keyword}/mode/{$mode}/center_id/{$center_id}/type/-10/ptype/{$ptype}">全部</a>
					</li>
					<li <if condition="$type eq 1">class="current"</if>>
						<a href="__APP__/Financial/project_funds/keyword/{$keyword}/mode/{$mode}/center_id/{$center_id}/type/1/ptype/{$ptype}">开票</a>
					</li>
					<li <if condition="$type eq 2">class="current"</if>>
						<a href="__APP__/Financial/project_funds/keyword/{$keyword}/mode/{$mode}/center_id/{$center_id}/type/2/ptype/{$ptype}">收款</a>
					</li>
				</ul>
			</div>
		</div>
		<div class="table-scrollx">
			<table <if condition="$mode eq 2">class="table table-bordered"<else/>class="table table-bordered table-hover"</if>>
				<tr class="table-header fixed-table-header">
					<td width="">项目编号</td>
					<td width="">项目名称</td>
					<td width="100">项目类型</td>
					<if condition="$mode eq 1">
						<td width="">款项阶段</td>
						<if condition="$type neq 2">
							<td width="">应开票金额</td>
							<td width="">应开票日期</td>
						</if>
						<td width="">已开票金额</td>
						<td width="">已开票日期</td>
						<if condition="$type neq 2">
							<td width="">剩余应开票金额</td>
						</if>
						<if condition="$type neq 1">
							<td width="">已收款金额</td>
							<td width="">已收款日期</td>
							<td width="">剩余应收款金额</td>
						</if>
						<td width="">添加人(日期)</td>
					<else/>
						<td width="">合同金额</td>
						<td width="">添加人(日期)</td>
						<td width="">款项阶段</td>
						<if condition="$type neq 2">
							<td width="">应开票金额</td>
							<td width="">应开票日期</td>
						</if>
						<td width="">已开票金额</td>
						<td width="">已开票日期</td>
						<if condition="$type neq 2">
							<td width="">剩余应开票金额</td>
						</if>
						<if condition="$type neq 1">
							<td width="">已收款金额</td>
							<td width="">已收款日期</td>
							<td width="">剩余应收款金额</td>
						</if>
					</if>
				</tr>
				<if condition="$result eq NULL">
				<tr>
					<td <if condition="$mode eq 1"><if condition="$type eq -10">colspan="13"<else/>colspan="10"</if><else/><if condition="$type eq -10">colspan="14"<else/>colspan="11"</if></if> class="text-center">暂无相关内容</td>
				</tr>
				</if>
				<if condition="$mode eq 1">
					<foreach name="result" item="vo">
						<tr>
							<td><a class="xm_btn" href="javascript:;" aaaid="{$vo['fid']}">{$vo['project_num']}</a></td>
							<td>{$vo['project_name']}</td>
							<td>{$vo['p_typen']}</td>
							<td>第{$vo['stage']}阶段</td>
							<if condition="$type neq 2">
								<td><if condition="$vo['tid'] neq NULL">{$vo['ticket_money']+0}</if></td>
								<td><if condition="$vo['tid'] neq NULL">{$vo['ticket_date']}</if></td>
							</if>
							<td><a class="kp_btn" href="javascript:;" title="{$vo['invoice']}" data-placement="left" data-toggle="tooltip" <if condition="$vo['tid'] neq NULL">bbbid="{$vo['id']}"<else/>bbbid="{$vo['sid']}"</if>>{$vo['fmoney']+0}</a> <if condition="get_permission('KX',NULL,1) or get_permission('KX',NULL,2)"><if condition="$vo['tid'] neq NULL"><if condition="$vo['del'] eq 1"><a href="__APP__/Financial/invoice_edit/id/{$vo['id']}/mid/{$vo['fid']}/keyword/{$keyword}/mode/{$mode}/center_id/{$center_id}/type/{$type}/ptype/{$ptype}" data-toggle="tooltip" data-placement="left" title="编辑" class="ml5"><i class="glyphicon glyphicon-edit"></i></a> <a href="javascript:;" mid="{$vo['id']}" action="two" operation="del" data-toggle="tooltip" data-placement="left" title="删除" class="delete1 ml5"><i class="glyphicon glyphicon-trash"></i></a></if></if></if></td>
							<td>{$vo['fdate']}</td>
							<if condition="$type neq 2">
								<td><if condition="$vo['tid'] neq NULL">{$vo['syykp']}</if></td>
							</if>
							<if condition="$type neq 1">
								<td><if condition="$vo['tid'] eq NULL"><a class="sk_btn" href="javascript:;" cccid="{$vo['id']}">{$vo['money']+0}</a> <if condition="get_permission('KX',NULL,1) or get_permission('KX',NULL,3)"><if condition="$vo['del'] eq 1"><a href="__APP__/Financial/receivables_edit/id/{$vo['id']}/mid/{$vo['fid']}/fid/{$vo['kid']}/keyword/{$keyword}/mode/{$mode}/center_id/{$center_id}/type/{$type}/ptype/{$ptype}" data-toggle="tooltip" data-placement="left" title="编辑" class="ml5"><i class="glyphicon glyphicon-edit"></i></a> <a href="javascript:;" mid="{$vo['id']}" action="three" operation="del" data-toggle="tooltip" data-placement="left" title="删除" class="delete2 ml5"><i class="glyphicon glyphicon-trash"></i></a></if></if></if></td>
								<td><if condition="$vo['tid'] eq NULL">{$vo['date']}</if></td>
								<td><if condition="$vo['tid'] eq NULL">{$vo['syysk']}</if></td>
							</if>
							<td>{$vo['add_user']}({$vo['add_date']|substr=0,10})</td>
						</tr>
					</foreach>
				<else/>
					<volist name="result" id="vo" mod="2">
						<tr <eq name="mod" value="1">class="background"</eq>>
							<td <eq name="mod" value="1">class="background"</eq> rowspan="{$vo['max']}"><a class="xm_btn" href="javascript:;" aaaid="{$vo['id']}">{$vo['project_num']}</a> <if condition="get_permission('KX',NULL,1)"><if condition="$vo['nedit'] neq 1"><a href="__APP__/Financial/project_funds_edit/id/{$vo['id']}/keyword/{$keyword}/mode/{$mode}/center_id/{$center_id}/type/{$type}/ptype/{$ptype}" data-toggle="tooltip" data-placement="bottom" title="编辑" class="ml5"><i class="glyphicon glyphicon-edit"></i></a></if> <if condition="$vo['ndel'] neq 1"><a href="javascript:;" mid="{$vo['id']}" action="one" operation="del" data-toggle="tooltip" data-placement="bottom" title="删除" class="delete3 ml5"><i class="glyphicon glyphicon-trash"></i></a></if></if></td>
							<td <eq name="mod" value="1">class="background"</eq> rowspan="{$vo['max']}">{$vo['project_name']}</td>
							<td <eq name="mod" value="1">class="background"</eq> rowspan="{$vo['max']}">{$vo['p_typen']}</td>
							<td <eq name="mod" value="1">class="background"</eq> rowspan="{$vo['max']}">{$vo['contract_money']}</td>
							<td <eq name="mod" value="1">class="background"</eq> rowspan="{$vo['max']}">{$vo['add_user']}({$vo['add_date']|substr=0,10})</td>
							<foreach name="vo['two']" item="to">
							<td <eq name="mod" value="1">class="background"</eq> rowspan="{$to['max2']}">第{$to['stage']}阶段</td>
							<if condition="$type neq 2">
							<td <eq name="mod" value="1">class="background"</eq> rowspan="{$to['max2']}">{$to['ticket_money']+0}</td>
							<td <eq name="mod" value="1">class="background"</eq> rowspan="{$to['max2']}">{$to['ticket_date']}</td>
							</if>
							<if condition="$to['three'] eq NULL">
								<if condition="$type neq 1">
									<td <eq name="mod" value="1">class="background"</eq>></td>
									<td <eq name="mod" value="1">class="background"</eq>></td>
									<td <eq name="mod" value="1">class="background"</eq>></td>
								</if>
								<td <eq name="mod" value="1">class="background"</eq>></td>
								<td <eq name="mod" value="1">class="background"</eq>></td>
								<if condition="$type neq 2">
								<td <eq name="mod" value="1">class="background"</eq>></td>
								</if>
								</tr>
							<else/>
								<if condition="$type neq 1">
									<foreach name="to['three']" item="fo" key="as">
									<td <eq name="mod" value="1">class="background"</eq> rowspan="{$fo['max3']}"><a class="kp_btn" href="javascript:;" title="{$fo['invoice']}" data-placement="left" data-toggle="tooltip" bbbid="{$fo['id']}">{$fo['money']+0}</a></td>
									<td <eq name="mod" value="1">class="background"</eq> rowspan="{$fo['max3']}">{$fo['date']}</td>
									<if condition="$type neq 2">
									<td <eq name="mod" value="1">class="background"</eq> rowspan="{$fo['max3']}"><if condition="$as eq 0">{$fo['syykp']}</if></td>
									</if>
									<if condition="$fo['four'] eq NULL">
										<td <eq name="mod" value="1">class="background"</eq>></td>
										<td <eq name="mod" value="1">class="background"</eq>></td>
										<td <eq name="mod" value="1">class="background"</eq>></td>
										</tr>
									<else/>
										<foreach name="fo['four']" item="ffo" key="asd">
										<td <eq name="mod" value="1">class="background"</eq>><a href="javascript:;" class="sk_btn" cccid="{$ffo['id']}">{$ffo['money']+0}</a></td>
										<td <eq name="mod" value="1">class="background"</eq>>{$ffo['date']}</td>
										<td <eq name="mod" value="1">class="background"</eq>><if condition="$asd eq 0">{$ffo['syysk']}</if></td>
										</tr>
										</foreach>
									</if>
									</foreach>
								<else/>
									<foreach name="to['three']" item="fo" key="as">
									<td <eq name="mod" value="1">class="background"</eq> rowspan="{$fo['max3']}"><a class="kp_btn" href="javascript:;" title="{$fo['invoice']}" data-placement="left" data-toggle="tooltip" bbbid="{$fo['id']}">{$fo['money']+0}</a></td>
									<td <eq name="mod" value="1">class="background"</eq> rowspan="{$fo['max3']}">{$fo['date']}</td>
									<if condition="$type neq 2">
									<td <eq name="mod" value="1">class="background"</eq> rowspan="{$fo['max3']}"><if condition="$as eq 0">{$fo['syykp']}</if></td>
									</if>
									</tr>
									</foreach>
								</if>
							</if>
						</foreach>
					</volist>
				</if>
			</table>
		</div>
		<div class="pages">{$page}</div>
	</div>
</div>
<!--项目弹框-->
<div class="modal fade" id="xm-modal">
	<div class="modal-dialog w800">
		<div class="modal-content">
			<div class="modal-header">
				<h4>项目款项详情</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body">
				
			</div>
		</div>
	</div>
</div>
<!--开票弹框-->
<div class="modal fade" id="kp-modal">
	<div class="modal-dialog w800">
		<div class="modal-content">
			<div class="modal-header">
				<h4>项目开票详情</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body">
				
			</div>
		</div>
	</div>
</div>
<!--收款弹框-->
<div class="modal fade" id="sk-modal">
	<div class="modal-dialog w800">
		<div class="modal-content">
			<div class="modal-header">
				<h4>项目收款详情</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body">
				
			</div>
		</div>
	</div>
</div>
<include file="Include:javascript" />
<script type="text/javascript">
$(function(){
	//删除
	$(".delete1").ajaxModal({"title_text":"确认提示框","body_text":"您确定要删除吗？","url":"__APP__/Financial/project_funds_detail","data":{"id":"mid","action":"action","operation":"operation"}});
	$(".delete2").ajaxModal({"title_text":"确认提示框","body_text":"您确定要删除吗？","url":"__APP__/Financial/project_funds_detail","data":{"id":"mid","action":"action","operation":"operation"}});
	$(".delete3").ajaxModal({"title_text":"确认提示框","body_text":"您确定要删除吗？","url":"__APP__/Financial/project_funds_detail","data":{"id":"mid","action":"action","operation":"operation"}});
	//搜索
	$(".found_btn").keywordSearch("__APP__/Financial/project_funds/keyword/$keyword/mode/{$mode}/center_id/{$center_id}/type/{$type}/ptype/{$ptype}");

	$('.xm_btn').click(function(){
		$('#xm-modal').modal();
		var id = $(this).attr("aaaid");
		$.ajax({
			type:"POST",
			async:false,
			dataType:"json",
			data:{"id":id,"action":"one"},
			url:"__APP__/Financial/project_funds_detail",
			success:function(data){
				var html="";
				html+= "<div class='form-main' style='border:none;margin-bottom:0'><div class='form-item'><div class='input-label'>所属中心</div><div class='input-item'>"+data.main.center_name+"</div></div><div class='form-item'><div class='input-label'>项目编号/名称</div><div class='input-item'>"+data.main.project_num+"/"+data.main.project_name+"</div></div><div class='form-item'><div class='input-label'>合同金额</div><div class='input-item'>"+data.main.contract_money+"</div></div><div class='form-item'><div class='input-label'>合同日期</div><div class='input-item'>"+data.main.contract_date+"</div></div><div class='form-item'><div class='input-label'>合同附件</div><div class='input-item'>";
				if(data.main.file_url){
					html+=""+data.main.file_name+"<a href='"+data.main.file_url+"' target='_blank' data-toggle='tooltip' data-placement='right' title='下载' class='ml5 download'><i class='glyphicon glyphicon-download-alt'></i></a>";
				}
				html+="</div></div><div class='form-item'><div class='input-label'>添加人(日期)</div><div class='input-item'>"+data.main.add_user+"("+data.main.add_date.slice(0,10)+")</div></div><div class='form-sub-title'>款项阶段</div></div><div class='form-table-item'><table class='table stage_table'><tr class='form-table-header'><td>阶段</td><td>应收款金额</td><td>百分比</td><td>应收款日期</td><td>应开票金额</td><td>应开票日期</td><td>预警日期</td><td>催款日期</td></tr>";
				for(var i=0; i<data.stage.length; i++){
					html+= "<tr><td>└第"+data.stage[i].stage+"阶段</td><td>"+data.stage[i].stage_money+"</td><td>"+data.stage[i].bili+"</td><td>"+data.stage[i].stage_date+"</td><td>"+data.stage[i].ticket_money+"</td><td>"+data.stage[i].ticket_date+"</td><td>"+data.stage[i].warn_date+"</td><td>"+data.stage[i].press_date+"</td></tr>"
				}
				html+= "</table></div>";
				$('#xm-modal .modal-body').html(html);
				$(".download").tooltip({trigger:'hover'});
			}
		})
	})
	$('.kp_btn').click(function(){
		$('#kp-modal').modal();
		var id = $(this).attr("bbbid");
		$.ajax({
			type:"POST",
			async:false,
			dataType:"json",
			data:{"id":id,"action":"two"},
			url:"__APP__/Financial/project_funds_detail",
			success:function(data){
				var html="";
				html+= "<div class='form-main' style='border:none;margin-bottom:0'><div class='form-item'><div class='input-label'>项目编号/名称</div><div class='input-item'>"+data.project_num+"/"+data.project_name+"</div></div><div class='form-item'><div class='input-label'>合同金额</div><div class='input-item'>"+data.contract_money+"</div></div><div class='form-item'><div class='input-label'>合同日期</div><div class='input-item'>"+data.contract_date+"</div></div><div class='form-item'><div class='input-label'>合同附件</div><div class='input-item'>";
				if(data.file_url){
					html+= ""+data.file_name+"<a href='"+data.file_url+"' target='_blank' data-toggle='tooltip' data-placement='right' title='下载' class='ml5 download'><i class='glyphicon glyphicon-download-alt'></i></a>";
				}
				html+= "</div></div><div class='form-item'><div class='input-label'>款项阶段</div><div class='input-item'>第"+data.stage+"阶段</div></div><div class='form-item'><div class='input-label'>该阶段应开票金额</div><div class='input-item'>"+data.ticket_money+"</div></div><div class='form-item'><div class='input-label'>该阶段已开票金额</div><div class='input-item'>"+data.ykp+"</div></div><div class='form-item'><div class='input-label'>本次开票金额</div><div class='input-item'>"+data.money+"</div></div><div class='form-item'><div class='input-label'>本次开票日期</div><div class='input-item'>"+data.date+"</div></div><div class='form-item'><div class='input-label'>发票编号</div><div class='input-item'>"+data.invoice+"</div></div><div class='form-item'><div class='input-label'>添加人(日期)</div><div class='input-item'>"+data.add_user+"("+data.add_date.slice(0,10)+")</div></div></div>";
				$('#kp-modal .modal-body').html(html);
				$(".download").tooltip({trigger:'hover'});
			}
		})
	})
	$('.sk_btn').click(function(){
		$('#sk-modal').modal();
		var id = $(this).attr("cccid");
		$.ajax({
			type:"POST",
			async:false,
			dataType:"json",
			data:{"id":id,"action":"three"},
			url:"__APP__/Financial/project_funds_detail",
			success:function(data){
				var html="";
				html+= "<div class='form-main' style='border:none;margin-bottom:0'><div class='form-item'><div class='input-label'>项目编号/名称</div><div class='input-item'>"+data.project_num+"/"+data.project_name+"</div></div><div class='form-item'><div class='input-label'>合同金额</div><div class='input-item'>"+data.contract_money+"</div></div><div class='form-item'><div class='input-label'>合同日期</div><div class='input-item'>"+data.contract_date+"</div></div><div class='form-item'><div class='input-label'>合同附件</div><div class='input-item'>";
				if(data.file_url){
					html+=""+data.file_name+"<a href='"+data.file_url+"' target='_blank' data-toggle='tooltip' data-placement='right' title='下载' class='ml5 download'><i class='glyphicon glyphicon-download-alt'></i></a>";
				}
				html+="</div></div><div class='form-item'><div class='input-label'>发票编号</div><div class='input-item'>"+data.invoice+"</div></div><div class='form-item'><div class='input-label'>该发票编号开票金额</div><div class='input-item'>"+data.fmoney+"</div></div><div class='form-item'><div class='input-label'>该发票编号已收款金额</div><div class='input-item'>"+data.ysk+"</div></div><div class='form-item'><div class='input-label'>本次收款金额</div><div class='input-item'>"+data.money+"</div></div><div class='form-item'><div class='input-label'>本次收款日期</div><div class='input-item'>"+data.date+"</div></div><div class='form-item'><div class='input-label'>添加人(日期)</div><div class='input-item'>"+data.add_user+"("+data.add_date.slice(0,10)+")</div></div></div>";
				$('#sk-modal .modal-body').html(html);
				$(".download").tooltip({trigger:'hover'});
			}
		})
	})
});
</script>
</body>
</html>